#include "mainwindow.h"
#include "ui_mainwindow.h"

#include "dialog.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    Dialog* dialog = new Dialog(this);
    dialog->resize(400,300);
    //设置Qt::WA_DeleteOnClose属性,让对话框关闭就释放,避免内存泄漏
    dialog->setAttribute(Qt::WA_DeleteOnClose);
    //显示对话框
    dialog->show();
}
